//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// 
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU Lesser General Public License for more details.
// 
// You should have received a copy of the GNU Lesser General Public License
// along with this program.  If not, see http://www.gnu.org/licenses/.
//

simple Sensor
{
    parameters:
        int xpos;
        int ypos;
        double pixel2meterRatio=1;
        int transmitRange;
       // double energy=1000000;
        @display("p=$xpos,$ypos;i=misc/node;is=vs");
    gates:
        input in[];  // declare in[] and out[] to be vector gates
        output out[];
}
simple BaseStation {
    parameters:
        int xpos;
        int ypos;
         @display("p=$xpos,$ypos;i=device/antennatower_l;o=blue");
     gates:
        input in[];  // declare in[] and out[] to be vector gates
        output out[];
}

network WSN
{
    parameters:
        int xMax;
        int yMax;
        int numNodes;
        int transmitRangeWSN;
        int sensorRangeWSN;
        int dataPacketPerRound;
        int protocol;
        int finalRound;
        double energy;
        double p;
        //
        double K1;
        double K2;
        double K3;
        double K4;
        //@display("b=,,white,white;bgb=$xMax,$yMax;bgp=$xMax+20,$yMax+60,white;");

    submodules:
        node[numNodes]: Sensor {
            parameters:
                transmitRange =transmitRangeWSN;
                xpos = intuniform(10, xMax);                             
                ypos = intuniform(10, yMax);
        };
        baseStation : BaseStation {
            parameters:
                xpos=xMax/2;
        		ypos=yMax+10;
        };
                     
    connections allowunconnected:

}
